Add check_rerun_command util to commands.py#137
Open
TizzySaurus wants to merge 8 commits intomainfrom
Open
Conversation
❌ Deploy Preview for bot-core failed.
|
…heck_rerun_command` to better reflect purpose. - The util now automatically re-invokes the command when applicable, and sends an error message otherwise. Rest of core functionality remains the same.
check_rerun_job util to commands.pycheck_rerun_command util to commands.py
2 tasks
✅ Deploy Preview for bot-core ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rewrites the logic of the eval command in python-discord/bot to create a re-run util (the eval command implementation had flaws, e.g including the python version to run in the edited message caused it to break since the version would be treated as code, and not the python version argument).
The core idea:
check_rerun_commandutil.REDO_TIMEOUTseconds, and the user then reacts with the 🔁 emoji that appears within 10 seconds, then the util will rerun the command (NB: this means commands with usage statistics will have the rerun add to the statistic, which doesn't currently happen but we arguably want this anyway).This is made since python-discord/sir-lancebot#1062 asks for re-run, and as such I got approval from @mbaruh in the staff-lounge to move (and as it turns out, fix) the code from bot.
I have thoroughly tested this but there's of course still a chance I missed something. Example usage of the util to aid with testing: